<template>
  <el-breadcrumb separator="/">
    <el-breadcrumb-item to="/home">面板</el-breadcrumb-item>
    <el-breadcrumb-item v-for="(item, index) in newFather" :key="index">
      {{ item.meta.title }}
    </el-breadcrumb-item>
  </el-breadcrumb>
</template>

<script>
export default {
  name: "TabIndex",
  components: {},
  props: {},
  data() {
    return {
      loadPath: [],
    };
  },
  computed: {
    // 去除
    newFather() {
      return this.loadPath.filter(function(item, index) {
        return index !== 0;
      });
    },
  },
  watch: {
    // 监听路由改变,调用添加新的路由
    $route() {
      this.getBreadcrumbPath();
    },
  },
  created() {
    this.getBreadcrumbPath();
  },
  mounted() {},
  methods: {
    getBreadcrumbPath() {
      const path = this.$route.matched;
      this.loadPath = path;
    },
  },
};
</script>

<style lang="less" scoped>
/deep/.el-breadcrumb__inner {
  color: #fff !important;
}
</style>
